.class Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;
.super Landroid/os/AsyncTask;
.source "ViewPagerAdapter.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/opongo/blogapp/adapter/ViewPagerAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "downloadOldPostsAsyncTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/Integer;",
        "Ljava/lang/Void;",
        "Ljava/lang/Integer;",
        ">;"
    }
.end annotation


# instance fields
.field private mAdapterPosition:I

.field final synthetic this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

.field private update:Z


# direct methods
.method private constructor <init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)V
    .locals 1
    .parameter

    .prologue
    .line 492
    iput-object p1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    .line 496
    const/4 v0, -0x1

    iput v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->mAdapterPosition:I

    .line 497
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->update:Z

    return-void
.end method

.method synthetic constructor <init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 492
    invoke-direct {p0, p1}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)V

    return-void
.end method


# virtual methods
.method protected varargs doInBackground([Ljava/lang/Integer;)Ljava/lang/Integer;
    .locals 8
    .parameter "params"

    .prologue
    const/4 v4, 0x1

    .line 502
    const/4 v0, 0x0

    aget-object v0, p1, v0

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    iput v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->mAdapterPosition:I

    .line 504
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->mAdapterArray:Ljava/util/ArrayList;
    invoke-static {v0}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$0(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Ljava/util/ArrayList;

    move-result-object v0

    iget v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->mAdapterPosition:I

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 506
    .local v6, mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;
    const/16 v3, 0x14

    .line 507
    .local v3, postperpage:I
    iget v2, v6, Lcom/opongo/blogapp/adapter/PostListAdapter;->page:I

    .line 510
    .local v2, page:I
    aget-object v0, p1, v4

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    if-ne v0, v4, :cond_0

    .line 511
    mul-int/2addr v3, v2

    .line 512
    const/4 v2, 0x1

    .line 514
    iput-boolean v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->update:Z

    .line 521
    :goto_0
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->apiManager:Lcom/opongo/blogapp/manager/APIManager;
    invoke-static {v0}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$7(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Lcom/opongo/blogapp/manager/APIManager;

    move-result-object v0

    iget v1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->mAdapterPosition:I

    .line 522
    const/4 v4, 0x0

    const/4 v5, -0x1

    .line 521
    invoke-virtual/range {v0 .. v5}, Lcom/opongo/blogapp/manager/APIManager;->getPosts(IIILjava/lang/String;I)Ljava/util/ArrayList;

    move-result-object v7

    .line 524
    .local v7, posts:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/opongo/blogapp/common/Post;>;"
    iput-object v7, v6, Lcom/opongo/blogapp/adapter/PostListAdapter;->posts:Ljava/util/ArrayList;

    .line 526
    iget v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->mAdapterPosition:I

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    return-object v0

    .line 516
    .end local v7           #posts:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/opongo/blogapp/common/Post;>;"
    :cond_0
    iget v0, v6, Lcom/opongo/blogapp/adapter/PostListAdapter;->page:I

    add-int/lit8 v2, v0, 0x1

    goto :goto_0
.end method

.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/Integer;

    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->doInBackground([Ljava/lang/Integer;)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method

.method protected onPostExecute(Ljava/lang/Integer;)V
    .locals 5
    .parameter "p"

    .prologue
    .line 531
    iget-object v0, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->es:Ljava/util/concurrent/ExecutorService;
    invoke-static {v0}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$8(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    new-instance v1, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$PostWorker;

    iget-object v2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I

    move-result v3

    iget-boolean v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->update:Z

    invoke-direct {v1, v2, v3, v4}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$PostWorker;-><init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;IZ)V

    invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V

    .line 532
    return-void
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 1
    check-cast p1, Ljava/lang/Integer;

    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$downloadOldPostsAsyncTask;->onPostExecute(Ljava/lang/Integer;)V

    return-void
.end method
